layui.define(['form','jquery','layer'], function (exports) {
     var $ = layui.jquery;
     var  layer = layui.layer;
     var form = layui.form();

     var edit_grp=function(){};

      edit_grp.prototype.init=function(){
        $.post("/srv/rdo.php?", {tpl:"getSchool"}, function (d, e) {
           selectShowDataNoH("#mech",JSON.parse(d),"id","sch_name");
           $("#mech").prepend("<option value=''>选择机构</option>");
           $("#mech").val($("#smech").val());
           form.render('select');
        });    
      }

     var index = parent.layer.getFrameIndex(window.name);
     $('#btn_save').click(function(){
        if($("#grpname").val()==""){layer.msg("用户组名称不能为空");return false;}

        $.post("/html/user/srv/edit_grp.php", $("#form1").serialize(), function (d, e) {
            if(d=="ok"){
                layer.msg("保存成功！");
                setTimeout("parent.layer.close(parent.layer.getFrameIndex(window.name));",1500);
            }else{
                layer.msg(d);
            }
        });

     });
     
     var editRle=new edit_grp();
     editRle.init();

     exports('user_edit_grp',editRle);
});